<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html class="x-admin-sm">
    
    <head>
        <meta charset="UTF-8">
        <title>家政管理系统-V6.8</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="${pageContext.request.contextPath}/static/main_oa/css/font.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/static/main_oa/css/xadmin.css">
        <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/static/main_oa/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/static/main_oa/js/xadmin.js"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
            <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
            <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form">
                    <input type="hidden" name="id" value="${card.id}">
                    <div class="layui-form-item">
                        <label  class="layui-form-label">
                            家政卡号
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="cardid" name="cardid" value="${card.cardid}"  class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="type" class="layui-form-label">
                            卡类型
                        </label>
                        <div class="layui-input-inline">
                            <select id="type" name="cardtype" class="store">
                                    <c:if test="${card.cardtype == 0}">
                                        <option value="0" selected>小时卡</option>
                                        <option value="1">现金卡</option>
                                    </c:if>
                                    <c:if test="${card.cardtype == 1}">
                                        <option value="0">小时卡</option>
                                        <option value="1" selected>现金卡</option>
                                    </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="me" class="layui-form-label">
                            卡面额
                        </label>
                        <div class="layui-input-inline">
                            <select id="me" name="cdid" class="store">
                                <c:forEach items="${cardD}" var="data">
                                    <c:if test="${card.cdid == data.id}">
                                        <option selected value="${data.id}">${data.denomination}</option>
                                    </c:if>
                                    <c:if test="${card.cdid != data.id}">
                                        <option value="${data.id}">${data.denomination}</option>
                                    </c:if>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                  <div class="layui-form-item">
                      <label for="state" class="layui-form-label">
                          卡状态
                      </label>
                      <div class="layui-input-inline">
                          <select id="state" name="state" class="store">
                                <c:if test="${card.state == 0}">
                                    <option value="0">未售</option>
                                </c:if>
                                <c:if test="${card.state == 1}">
                                  <option value="1">已售</option>
                                </c:if>
                          </select>
                      </div>
                  </div>
                  
                  <div class="layui-form-item">
                      <label for="bsid" class="layui-form-label">
                          分店                     
                      </label>
                      <div class="layui-input-inline">
                          <select id="bsid" name="bsid" class="store">
                              <c:forEach items="${branchStoreS}" var="bs">
                                  <c:if test = "${bs.bsId == card.bsid}">
                                      <option selected value="${bs.bsId}">${bs.name}</option>
                                  </c:if>
                                  <c:if test = "${bs.bsId != card.bsid}">
                                      <option value="${bs.bsId}">${bs.name}</option>
                                  </c:if>
                              </c:forEach>
                          </select>
                      </div>
                  </div>
                  
                  <div class="layui-form-item layui-form-text">
                      <label for="remarks" class="layui-form-label">备注</label>
                      <div class="layui-input-block">
                          <textarea placeholder="请输入内容" id="remarks" name="remarks" class="layui-textarea">${card.remarks}</textarea>
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="L_repass" class="layui-form-label">
                      </label>
                      <button  class="layui-btn" lay-filter="add" lay-submit="">
                          修改
                      </button>
                  </div>
              </form>
            </div>
        </div>
        <script type="text/javascript" src="${pageContext.request.contextPath}/static/main_oa/js/xcity.js"></script>
        <script>

         layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;
        
          //执行一个laydate实例
          laydate.render({
            elem: '#sale_time' //指定元素
          });

          //执行一个laydate实例
          laydate.render({
            elem: '#put_time' //指定元素
          });

        });
        
        
        layui.use(['form','code'], function(){
            form = layui.form;

            layui.code();

            $('#city').xcity();

          });
        layui.use(['form', 'layer'],

            
            function() {
                $ = layui.jquery;
                var form = layui.form,
                layer = layui.layer;


                //监听提交
                form.on('submit(add)',
                function(data) {
                    console.log(data);
                    $.ajax({
                        type: 'post',
                        url: "${pageContext.request.contextPath}/admin/editE",
                        contentType: "application/json",
                        dataType:   "json",
                        data: JSON.stringify(data.field),
                        success: function (res) {
                            if(res){
                                layer.alert("修改成功", {
                                        icon: 6
                                    },
                                    function() {
                                        //关闭当前frame
                                        xadmin.close();
                                        // 可以对父窗口进行刷新
                                        xadmin.father_reload();
                                    });
                            }else{
                                layer.alert("修改失败", {
                                        icon: 7
                                    },
                                    function() {
                                        //关闭当前frame
                                        xadmin.close();
                                        // 可以对父窗口进行刷新
                                        xadmin.father_reload();
                                    });
                            }
                        }
                    });
                    return false;
                });

            });</script>
        <script>var _hmt = _hmt || []; (function() {
                var hm = document.createElement("script");
                hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();</script>
    </body>

</html>
